
<div class="card mb-2">
	<div class="card-body search-form">
		<form id="stockChecking-search-form">
			<input type="hidden" id="stockChecking_pageNumber" name="pageNumber">
			<div class="row align-items-center">
				<div class="col">
					<div class="row align-items-center">
						<div class="col-3">
							<div class="btn-group" role="group">
								<input type="radio" class="btn-check" name="order_time_btn" id="stockChecking_order_time_preday" value="1" autocomplete="off">
								<label class="btn btn-outline-primary" for="stockChecking_order_time_preday">昨日</label>
								<input type="radio" class="btn-check" name="order_time_btn" id="stockChecking_order_time_today" value="2" autocomplete="off">
								<label class="btn btn-outline-primary" for="stockChecking_order_time_today">今日</label>
								<input type="radio" class="btn-check" name="order_time_btn" id="stockChecking_order_time_month" value="3" autocomplete="off">
								<label class="btn btn-outline-primary" for="stockChecking_order_time_month">本月</label>
								<input type="radio" class="btn-check" name="order_time_btn" id="stockChecking_order_time_premonth" value="4" autocomplete="off">
								<label class="btn btn-outline-primary" for="stockChecking_order_time_premonth">上月</label>
								<input type="radio" class="btn-check" name="order_time_btn" id="stockChecking_order_time_year" value="5" autocomplete="off">
								<label class="btn btn-outline-primary" for="stockChecking_order_time_year">本年</label>
							</div>
						</div>
						<div class="col-2">
							<input type="hidden" name="handler_id" id="stockChecking_search_handler_id">
							<input type="text" class="form-control" placeholder="请输入盘点员姓名或简码"  id="stockChecking_search_handler_keyword" autocomplete="off">
						</div>
						<div class="col-3">
							<input type="text" class="form-control" placeholder="单据编号/备注" name="keyword" onclick="$(this).select();">
						</div>
						<div class="col align-self-center">
							<button type="submit" class="btn btn-sm btn-primary" onclick="stockChecking.search(this);">
								<i class="bi bi-search"></i>搜索
							</button>
							<span style="margin-left: 15px;"><a href="javascript:void(0);" onclick="common.expandFilter(this, 'stockChecking_expand_filter')">展开<i class="bi bi-chevron-double-down"></i></a></span>
						</div>
					</div>
					<div id="stockChecking_expand_filter" style="display: none;">
						<div class="row align-items-center mt-3">
							<div class="col-2">
								<input type="text" class="form-control" id="stockChecking_search_start_time" name="start_time" placeholder="开始时间" onClick="WdatePicker({el:this, startDate:'%y-%M-%d 00:00:00', dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly>
							</div>

							<div class="col-2">
								<input type="text" class="form-control" id="stockChecking_search_end_time" name="end_time" placeholder=" 结束时间" onClick="WdatePicker({el:this, startDate:'%y-%M-%d 00:00:00', dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly>
							</div>
						</div>
					</div>
				</div>
			</div>

		</form>
	</div>
</div>
<div id="data-list-stockChecking"></div>

<script type="application/javascript">
if(typeof(stockChecking) == "undefined") {
	stockChecking = {};
}

$(function() {
	// 初始化bootstrap相关组件
	common.initBootstrap();
	// 加载列表
	stockChecking.list();
	
	$('#stockChecking-search-form input[name=order_time_btn]').on('click', function() {
		var timeType = $(this).val();
		var times = datetime.getFormatTime(timeType);
		$("#stockChecking_search_start_time").val(times.startTime);
		$("#stockChecking_search_end_time").val(times.endTime);
		
		stockChecking.list();
	});
	
	stockChecking.loadingHandlerList();
	
});

stockChecking.list = function(targetId, callback) {
	var showAuditFlag = $("#stockChecking_show_audit_flag").prop("checked");
	if(typeof(showAuditFlag) == 'undefined') {
		showAuditFlag = false;
	}
	var hideDisableFlag = $("#stockChecking_hide_disable_flag").prop("checked");
	if(typeof(hideDisableFlag) == 'undefined') {
		hideDisableFlag = true;
	}
	var hideProfitLossFlag = $("#stockChecking_hide_profit_loss_flag").prop("checked");
	if(typeof(hideProfitLossFlag) == 'undefined') {
		hideProfitLossFlag = true;
	}
	$("#stockChecking_pageNumber").val(1);
	beekit.ajaxFillPage("/inventory/stock/checking/list?hide_disable_flag="+hideDisableFlag+"&show_audit_flag="+showAuditFlag+"&hide_profit_loss_flag="+hideProfitLossFlag, "#stockChecking-search-form", "#data-list-stockChecking" ,"stockChecking-data-"+targetId, callback);
};

stockChecking.add = function() {
	beekit.modal("/inventory/stock/checking/add");
};

stockChecking.search = function(othis) {
	common.loadingSearch(othis);
	stockChecking.list("", function(ret) {
		common.restoreSearch(othis);
	});
};

stockChecking.loadingHandlerList = function(id) {
	beekit.autocomplete("#stockChecking_search_handler_keyword", "/setting/tenant/admin/listByJson", "#stockChecking_search_handler_id", function() {
		stockChecking.list();
	});
}
		
</script>


